package com.nuan.shiro.constants;

public class ResultUtil {
    public ResultUtil() {
    }

    public static <T> Result<T> success(T data) {
        Result<T> result = new Result();
        result.setCode(200);
        result.setMsg("成功");
        result.setData(data);
        return result;
    }

    public static <T> Result<T> success() {
        return success(null);
    }

    public static <T> Result<T> error(CodeEnum errorCodeEnum) {
        Result<T> result = new Result();
        result.setCode(errorCodeEnum.getCode());
        result.setMsg(errorCodeEnum.getMsg());
        return result;
    }

}
